Fix last error reporting when calling GetClipboardOwner
authorLuca Bacci <luca.bacci982@gmail.com>
Fri, 25 Feb 2022 15:47:43 +0000 (16:47 +0100)
committerLuca Bacci <luca.bacci982@gmail.com>
Fri, 25 Feb 2022 16:02:26 +0000 (17:02 +0100)
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/1402

gdk/win32/gdkdisplay-win32.c

index 5671e2c25494734007ca16ef0444deccd0174e81..3afc34ce209211eb41c03aa1954c28a6857f827b 100644 (file)
@@ -550,11 +550,11 @@ inner_clipboard_window_procedure (HWND   hwnd,
         GdkWindow *stored_owner;
         GdkWin32Selection *win32_sel = _gdk_win32_selection_get ();
 
+        SetLastError (0);
         hwnd_owner = GetClipboardOwner ();
 
-        if ((hwnd_owner == NULL) &&
-            (GetLastError () != ERROR_SUCCESS))
-            WIN32_API_FAILED ("GetClipboardOwner");
+        if (hwnd_owner == NULL && GetLastError () != 0)
+          WIN32_API_FAILED ("GetClipboardOwner");
 
         hwnd_opener = GetOpenClipboardWindow ();